package jnaex;

import com.sun.jna.Structure;
import com.sun.jna.Pointer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Structure.FieldOrder({"session"})
public class JnaExObj extends Structure {
    private static final Logger log = LoggerFactory.getLogger("jnaex");

    public static class ByReference extends JnaExObj implements Structure.ByReference {}

    public String session;

    public JnaExObj() {}

    public JnaExObj(String session) {
        this.session = session;
    }

    public JnaExObj(Pointer pointer) {
        super(pointer);
    }

    public static void onCallback(String sessionid, Pointer userdata) {
        JnaExObj other = new JnaExObj(userdata);
        log.info("[ JnaExObj.callback ] recv session: {}, this: {}, and userdata: {}", sessionid, null, other);
    }
}
